#ifndef SYMBIANPROCESSRUNNER_H
#define SYMBIANPROCESSRUNNER_H

#include <QObject>
#include <QProcess>
#include <QStringList>

#include "defines.h"
#include "generatoroutputview.h"
#include "generatordata.h"

#include "symbianqtprojectgenerator.h"


class SymbianProcessRunner : public QObject
{
    Q_OBJECT

private:
    //
    // member variables
    //
    QProcess                   * m_process;
    SymbianQtProjectGenerator  & m_generator;
    GeneratorPhase               m_generatorAction;
    bool                         m_errorWordInLogMsg;

public:
    //
    // lifetime management
    //
    SymbianProcessRunner(SymbianQtProjectGenerator &generator);
    ~SymbianProcessRunner();

    //
    // public operators
    //
    void runApp(GeneratorPhase &generatorAction, const QStringList &params);
    bool errorWordInLogMessage();


    /**
      * Constructs a full command line from a partial command line.
      *
      * @partialCmdLine the essential command line you are interested in
      * executing.
      *
      * @return a full command line that is influenced by Settings::FullS60SDK,
      *         Settings::QtEnvPath settings as well as platform specific
      *         batch files.
      */
    static QString getFullCmdLine(const QString & partialCmdLine);

    //
    // private implementation details
    //
private slots:
    void readProcessStdout();

private:
    void startProcess(const QString &command, const QStringList &arguments);
    void runQMake();
    void runMake();
    void runMakeSis();
    void runUnzip(const QStringList &params);
};

#endif // SYMBIANPROCESSRUNNER_H
